var Koa = require('koa');
var Router = require('koa-router');
var cors = require('koa-cors');

var app = new Koa();
var router = new Router();
let config = require('./config') 

var server = require('http').createServer(app.callback());

//http方式 
require('./push/http.js')(router)

// websocket方式
require('./push/websocket.js')(app,server);

var options = {
	// origin: "http://127.0.0.1:8000",
	origin: "http://zane.morning-star.cn",
	credentials:true,
};
app
	.use(cors(options))
  	.use(router.routes())
  	.use(router.allowedMethods());

server.listen(config.prot);
